home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 4.3 KB | 178 lines | [TEXT/MPS ] |
- {$P}
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
- {UTEView.Globals.p}
- { Copyright © 1985 - 1990 Apple Computer, Inc. All rights reserved. }
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEInit}
-
- PROCEDURE InitUTEView;
-
- BEGIN
- IF qTemplateViews THEN
- BEGIN
- { So linker doesn't strip TTEView class }
- IF gDeadStripSuppression THEN
- IF Member(TObject(NIL), TTEView) THEN;
- RegisterStdType('TTEView', kStdTEView);
- END;
-
- gUTEViewInitialized := TRUE;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDebug}
-
- PROCEDURE WriteChar(index: INTEGER;
- hText: Handle);
-
- CONST
- kMaxIndex = 2047;
-
- TYPE
- x = PACKED ARRAY [0..kMaxIndex] OF Char;
- XPtr = ^x;
- XHandle = ^XPtr;
-
- BEGIN
- IF index <= kMaxIndex THEN
- Write('[', index: 1, ':', XHandle(hText)^^[index]: 1, '] ');
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDebug}
-
- PROCEDURE DumpTERecord(aTEH: TEHandle);
-
- CONST
- kMaxCharsToPrint = 100;
-
- VAR
- size: INTEGER;
- hText: Handle;
- i: INTEGER;
-
- BEGIN
- Write('TE -- dest rect: '); WriteRect(aTEH^^.destRect);
- WriteLn;
-
- size := aTEH^^.teLength;
- Write('Line ht: ', aTEH^^.lineHeight: 1);
- Write('; teLength: ', size: 1);
- Write('; hText length: ', GetHandleSize(aTEH^^.hText): 1);
- Write('; lines: ', aTEH^^.nLines: 1);
- WriteLn;
-
- IF gIntenseDebugging THEN
- BEGIN
- hText := aTEH^^.hText;
- Write('Chars: ');
- FOR i := 0 TO Min(kMaxCharsToPrint, Min(2047, size - 1)) DO
- BEGIN
- WriteChar(i, hText);
- IF i MOD 10 = 9 THEN
- WriteLn;
- END;
- WriteLn;
-
- Write('InPort vis bbox: '); WriteRect(aTEH^^.inPort^.visRgn^^.rgnBBox);
- Write('; clip bbox: '); WriteRect(aTEH^^.inPort^.clipRgn^^.rgnBBox);
- WriteLn;
-
- IF aTEH^^.inPort <> thePort THEN
- BEGIN
- Write('thePort vis bbox: '); WriteRect(thePort^.visRgn^^.rgnBBox);
- Write('; clip bbox: '); WriteRect(thePort^.clipRgn^^.rgnBBox); WriteLn;
- END;
- END;
-
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEFields}
-
- PROCEDURE DumpTTECommand(theTTECommand: TTECommand);
-
- TYPE
- TSPtr = ^TextStyle;
-
- VAR
- i: LONGINT;
- oldStyleSize: LONGINT;
- newStyleSize: LONGINT;
- last: LONGINT;
-
- BEGIN
- WITH theTTECommand DO
- WriteLn('old start/end, new start/end, diff :', fOldStart: 0, '/', fOldEnd: 0, ', ',
- fNewStart: 0, '/', fNewEnd: 0, ', ', MAX(MAX(fOldEnd - fOldStart, 0), MAX(fNewEnd -
- fNewStart, 0)): 0);
- WriteLn('fTextPad :', theTTECommand.fTextPad: 0);
- WriteLn('fPadding size :', GetHandleSize(theTTECommand.fPadding): 0);
-
- oldStyleSize := 0;
- newStyleSize := 0;
- WriteLn('** Old styles:');
- IF theTTECommand.fOldStyles = NIL THEN
- WriteLn('NONE!')
- ELSE
- BEGIN
- last := theTTECommand.fOldStyles^^.scrpNStyles;
- WriteLn('Number of table entries: ', last: 0);
- FOR i := 0 TO last - 1 DO
- WITH theTTECommand.fOldStyles^^.scrpStyleTab[i] DO
- BEGIN
- Write(i: 0, ', ofs:', scrpStartChar: 0, ' ');
- WrLblField('', @scrpFont, bStyle);
- WriteLn;
- END;
- oldStyleSize := GetHandleSize(Handle(theTTECommand.fOldStyles));
- END;
-
- WriteLn('** New styles:');
- IF theTTECommand.fNewStyles = NIL THEN
- WriteLn('NONE!')
- ELSE
- BEGIN
- last := theTTECommand.fNewStyles^^.scrpNStyles;
- WriteLn('Number of table entries: ', last: 0);
- FOR i := 0 TO last - 1 DO
- WITH theTTECommand.fNewStyles^^.scrpStyleTab[i] DO
- BEGIN
- Write(i: 0, ', ofs:', scrpStartChar: 0, ' ');
- WrLblField('', @scrpFont, bStyle);
- WriteLn;
- END;
- newStyleSize := GetHandleSize(Handle(theTTECommand.fNewStyles));
- END;
-
- WriteLn('Styles size diff: ', MAX(newStyleSize, oldStyleSize): 0);
- WriteLn('fStylePad :', theTTECommand.fStylePad: 0);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
-
- PROCEDURE SetSelect(theStart, theEnd: INTEGER;
- hTE: TEHandle);
-
- BEGIN
- WITH hTE^^ DO
- BEGIN
- selStart := theStart;
- selEnd := theEnd;
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TENonRes}
-
- FUNCTION ClickLoopForTTEView: BOOLEAN;
-
- BEGIN
- IF pCurrTEView <> NIL THEN
- ClickLoopForTTEView := pCurrTEView.ClikLoop
- ELSE
- ClickLoopForTTEView := TRUE;
- END;
-